import * as actionType from "./constants";
import {reqmain} from "../../../api/index"
export const changeMainData=(data)=>{
    // console.log('成功了');
    return{
        type:actionType.CHANGE_MAINDATA,
        data:data
    }
}

export const setIndex=(data)=>{
    return{
        type:actionType.SET_INDEX,
        data:data
    }
}

export const getMainData=()=>{
    return(disPatch)=>{
        reqmain()
        .then((res)=>{
            // console.log(res,'res');
            disPatch(changeMainData(res.data.data))
        })
        .catch(()=>{
            console.log('出错了');
        })
    }
}